/*
 * 下载的服务
 */
const express = require('express')
const route = express.Router()
const path = require('path')
const fs = require('fs')

const download = require('./download')

route.get('/', (req, res) => {
    let filepath = path.resolve(__dirname, 'index.html')
    res.send(fs.readFileSync(filepath, 'utf-8'))
})

// 类似：xxx/download/readme.txt
route.get('/:file', download)

module.exports = {
    path: '/download',
    route
}